import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/collect/collect.dart';
import 'package:flutter_demo/ui/pages/home/home.dart';

class AppBottomNavigationBar {
  // 底部导航页面列表
  static final List<Widget> pages = [
    HomePage(),
    CollectPage(),
    CollectPage(),
  ];

  // 底部导航 Icon 列表
  static final List<BottomNavigationBarItem> items = [
    buildBarItem(title: "首页", icon: Icon(Icons.home)),
    buildBarItem(title: "收藏", icon: Icon(Icons.star)),
    buildBarItem(title: "收藏1", icon: Icon(Icons.star)),
  ];

  // 底部导航 Icon 生成器
  static BottomNavigationBarItem buildBarItem ({
    String title = "",
    Icon icon = const Icon(Icons.settings),
    Icon activeIcon,
  }) {
    if(activeIcon == null) {
      activeIcon = icon;
    }
    return BottomNavigationBarItem(
      title: Text(title),
      icon: icon,
      activeIcon: activeIcon
    );
  }
}